<?php 
defined('IN_TS') or die('Access Denied.');

$arrStudy = $new['study']->findAll('study');

foreach($arrStudy as $key=>$item){
	$isLearn = $new['study']->findCount('study_learn',array(
		'userid'=>$item['userid'],
		'studyid'=>$item['studyid'],
	));
	
	if($isLearn==0){
		$new['study']->create('study_learn',array(
			'userid'=>$item['userid'],
			'studyid'=>$item['studyid'],
			'status'=>1,
			'addtime'=>time(),
		));
	}
	
}

echo 'OK';